home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK2.toast / Development Kits (Disc 2) / QuickDraw GX / Programming Stuff / Sample Code / General App Samples / QDGX Shell ƒ / QDGX shell.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-20  |  3.3 KB  |  125 lines  |  [TEXT/MMCC]

  1. /****************************************************************************/
  2. /*                                                                            */
  3. /*    interfaces for a simple, MULTI-window graphics shell                    */
  4. /*                                                                            */
  5. /*    ©1990 - 1994  Apple Computer, Inc.                                        */
  6. /*    All rights reserved.                                                    */
  7. /*                                                                            */
  8. /****************************************************************************/
  9.  
  10. #include <Desk.h>
  11. #include <Events.h>
  12. #include <Fonts.h>
  13. #include <Windows.h>
  14. #include <Memory.h>
  15. #include <ToolUtils.h>
  16. #include <Menus.h>
  17. #include <Resources.h>
  18. #include <Quickdraw.h>
  19. #include <GestaltEqu.h>
  20. #include <CodeFragments.h>
  21.  
  22. #include <GXEnvironment.h>
  23. #include <GXGraphics.h>
  24. #include <GXPrinting.h>
  25. #include <GXPrinting.h>
  26. #include <GXErrors.h>
  27. #include "GraphicsLibraries.h"
  28. #include "FontLibrary.h"
  29. #include "QDLibrary.h"
  30.  
  31.  
  32.  
  33.  
  34. /**\
  35. |**| ---------------------------------------------------------------------
  36. |**| EXTERN GLOBALS
  37. |**| ---------------------------------------------------------------------
  38. \**/
  39. // the following are expected to be initialized by the shell:
  40.  
  41. // QuickDraw GX shell.c:
  42.  
  43. extern Boolean        gQuitting;
  44.  
  45. // the following are expected to be initialized by your code:
  46.  
  47. extern Rect         gWindowQDRect;
  48. extern Str255        gWindowTitle;
  49. extern Boolean        gGiveMeValidation;
  50. extern long            gGraphicsHeapSize;
  51.  
  52.  
  53.  
  54. /**\
  55. |**| ---------------------------------------------------------------------
  56. |**| PROTOTYPES
  57. |**| ---------------------------------------------------------------------
  58. \**/
  59.  
  60. // QuickDraw GX shell.c:
  61.  
  62. void    main                    (void);
  63. void     InitToolbox                (void);
  64. void    CheckQuickDrawGX        (void);
  65. OSErr    MyPrintingEventOverride    (EventRecord *event, Boolean filterEvent);
  66. void    EventLoop                (void);
  67. Boolean    IsAppWindow                (WindowPtr wind);
  68. void    MyDoEvent                (EventRecord *event);
  69. void    DoMouseDown                (EventRecord *event);
  70.  
  71. // QDGX shell misc.c:
  72.  
  73. void    DoMenuCommand            (long menuResult);
  74. gxJob    GetDocJob                (WindowPtr);
  75. gxShape    GetDocShape                (WindowPtr);
  76. short    MyStrLength                (char *s);
  77.  
  78. // QDGX shell printing.c:
  79.  
  80. void    SetUpEditMenuRec        (gxEditMenuRecord *);
  81. OSErr    DoFormat                (WindowPtr, gxDialogResult    *);
  82. OSErr    DoPrinting                (WindowPtr);
  83. OSErr    DoPrintOne                (WindowPtr);
  84.  
  85. // routines required by your code
  86. void    DoSetup                    (void);
  87. void    DoDraw                    (WindowPtr wind, Boolean updating);
  88. OSErr    DoCreateNew                (void);
  89. void    DoDispose                (WindowPtr wind);
  90. void    DoIdle                    (WindowPtr wind);
  91. void    DoTeardown                (void);
  92. void    DoClick                    (WindowPtr wind, Point p);
  93.  
  94.  
  95.  
  96. /**\
  97. |**| ---------------------------------------------------------------------
  98. |**| ENUMS
  99. |**| ---------------------------------------------------------------------
  100. \**/
  101. enum dlogIDs {rAboutBoxID=128,rNoQuickDrawGXID=129};
  102.  
  103. enum mbarID {rMenuBar=128};
  104.  
  105. enum menus {mApple=128,mFile,mEdit};
  106.  
  107. enum mApplItems {iAbout=1};
  108. enum mFileItems {iNew=1,iOpen,iClose,iSave,iPageSetup=6,iPrint,iPrintOne,iQuit=10};
  109. enum mEditItems {iUndo=1,iCut=3,iCopy,iPaste,iClear};
  110.  
  111.  
  112. /**\
  113. |**| ---------------------------------------------------------------------
  114. |**| STRUCTS
  115. |**| ---------------------------------------------------------------------
  116. \**/
  117. // This is the structure we use to hold our private data for each window.
  118. // We store a handle to one of these beasties in each window's refCon field.
  119.  
  120. typedef struct
  121. {
  122.   gxJob        docJob;            // print job for this document.
  123.   gxShape    docPage;        // page shape description for this document.
  124. } T_Doc, *TP_Doc, **TH_Doc;
  125.